<!doctype html>
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>{$list['sys_title']} {$list['version']}</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta name="keywords" content="码蚁成绩,成绩管理,成绩统计,成绩分析,成绩查看">
    <meta name="description" content="适合自己的才是最好的！">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="__XADMIN__/css/font.css">
    <link rel="stylesheet" href="__XADMIN__/css/login.css">
	  <link rel="stylesheet" href="__XADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__XADMIN__/js/jquery.min.js"></script>
    <script src="__XADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script src="__XADMIN__/lib/layui/sliderVerify.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- // 百度统计代码  -->
        <script>
          var _hmt = _hmt || [];
          (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?6f65eecea5e089dae94d6b9cffec3623";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
          })();
        </script>
</head>
<body class="login-bg">
    <div class="login layui-anim layui-anim-up" style="margin-top: 60px;">
        <div class="message">{$list['sys_title']} {$list['version']}</div>
        <div id="darkbannerwrap"></div>
        <form method="post" class="layui-form" lay-verify="loginform" id="loginform">
            <input id="username" name="username" placeholder="帐号"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input id="password" name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input" autocomplete="off">
            <hr class="hr15">
            <select name="category" lay-verify="required" lay-filter="category">
              <option value="admin" selected="selected">教师</option>
              <option value="student">学生</option>
            </select>
            <hr class="hr15" id="thisafter">
              <div class="layui-form-item" style="margin-left:0px; margin-bottom: 0px;">
                <div id="slider" style="height: 50px"></div>
              </div>
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="float: right;" type="submit">
            <hr class="hr20" >
            <div style="color: #666666; text-align: center;">推荐使用Firefox、Chrome浏览器</div>
        </form>
    </div>
    <script type="text/javascript" charset="utf-8">
      layui.config({
        base: '__XADMIN__/lib/layui/'
      }).extend({
        sliderVerify:'sliderVerify'
      }).use(['sliderVerify', 'jquery', 'form'], function() {
        var sliderVerify = layui.sliderVerify,
          form = layui.form;

        var slider = sliderVerify.render({
          elem: '#slider',
          onOk: function(){
            //当验证通过回调
            // layer.msg("滑块验证通过");
          },
        })

        var url = '/login';

        //监听提交
        form.on('submit(login)', function(data){
          yz = slider.isOk();
          if(yz == false)
          {
            layer.msg("请先通过滑块验证");
            return false;
          }
          formval = data.field;
          switch(formval.category){
            case 'admin':
              url = '/login';
              break;
            case 'student':
              url = '/login/student';
              break;
            default:
              layer.msg('请先选择登录身份');
              return false;
          };

          $.ajax({
            url:url,
            type:'POST',
            async: true,
            data:data.field,
            success:function(result){
              if(result.val == 1)
              {
                window.location.href = result.url;
              }else{
                layer.msg(result.msg);
                $('#password').val('');
                slider.reset();
              }
            },
            error:function(result){
              $('#password').val('');
              layer.msg('数据扔半道，回不来啦。',function(){});
            },
          });
          return false;
        });
      })
    </script>


</body>
</html>
